<!--
 * @Description: 编辑砍价商品
 * @Author: Li Yujie
 * @Date: 2021/02/02
 * @Last Modified by: Li Yujie
 * @Last Modified time: 2021/02/02
-->
<template>
    <div class="wrapper">
        <div class="content-wrapper">
            <!-- header -->
            <div class="header">
                <div class="header-title">
                    {{ type === 'add' ? '添加商品/优惠券/红包' : '编辑商品/优惠券/红包' }}
                </div>
            </div>
            <!-- /header -->
            <el-tabs
                v-model="ruleForm.aim_type"
                @tab-click="$refs.ruleForm.clearValidate()"
            >
                <el-tab-pane
                    label="商品选择"
                    name="goods"
                    :disabled="type === 'edit'"
                />
                <el-tab-pane
                    label="优惠券选择"
                    name="platform_coupon"
                    :disabled="type === 'edit'"
                />
                <el-tab-pane
                    label="商家优惠券"
                    name="merchant_coupon"
                    :disabled="type === 'edit'"
                />
                <el-tab-pane
                    label="平台红包"
                    name="red_packet"
                    :disabled="type === 'edit'"
                />
            </el-tabs>
            <!--表单-->
            <el-form
                :model="ruleForm"
                :rules="rules"
                label-position="right"
                ref="ruleForm"
                label-width="160px"
                class="form-wrap"
            >
                <div v-if="type === 'add' && ruleForm.aim_type === 'goods'">
                    <el-form-item
                        label="选择自营商品"
                        prop="goods_no"
                    >
                        <el-button
                            size="medium"
                            type="primary"
                            @click="$refs.goodsSelect.show(1,requestUrl)"
                        >
                            选择商品
                        </el-button>
                    </el-form-item>
                </div>
                <div v-if="type === 'add' && ruleForm.aim_type === 'platform_coupon'">
                    <el-form-item
                        label="选择平台优惠券"
                        prop="coupon_no"
                    >
                        <el-button
                            size="medium"
                            type="primary"
                            @click="$refs.couponSelect.show('platform_coupon')"
                        >
                            选择平台优惠券
                        </el-button>
                    </el-form-item>
                </div>
                <div v-if="type === 'add' && ruleForm.aim_type === 'merchant_coupon'">
                    <el-form-item
                        label="选择商家优惠券"
                        prop="shop_coupon_no"
                    >
                        <el-button
                            size="medium"
                            type="primary"
                            @click="$refs.shopCouponSelect.show('merchant_coupon')"
                        >
                            选择商家优惠券
                        </el-button>
                    </el-form-item>
                </div>
                <div v-if="type === 'add' && ruleForm.aim_type === 'red_packet'">
                    <el-form-item
                        label="选择平台红包"
                        prop="packet_no"
                    >
                        <el-button
                            size="medium"
                            type="primary"
                            @click="$refs.redPacketSelect.show()"
                        >
                            选择平台红包
                        </el-button>
                    </el-form-item>
                </div>
                <template v-if="ruleForm.aim_type === 'goods'">
                    <el-form-item
                        label="商品缩略图"
                        v-if="goods.goods_cover"
                    >
                        <img
                            :src="goods.goods_cover"
                            alt="加载失败"
                            style="width:80px;height:80px;cursor: pointer"
                            @click="fnShowPreview(goods.goods_cover)"
                        >
                    </el-form-item>
                    <el-form-item
                        label="商品原标题"
                        v-if="goods.goods_title"
                    >
                        {{ goods.goods_title }}
                    </el-form-item>
                    <el-form-item
                        label="商品编号"
                    >
                        {{ ruleForm.goods_no }}
                    </el-form-item>
                    <el-form-item
                        label="砍价标题"
                    >
                        <el-input
                            v-model="ruleForm.title"
                            placeholder="砍价标题"
                            size="medium"
                            clearable
                            style="width: 380px"
                        />
                        <span class="tips">砍价活动页显示的标题</span>
                    </el-form-item>
                    <el-form-item label="砍价活动设置">
                        <el-table
                            :data="ruleForm.price_list"
                            style="width: 100%;border: 1px solid #eee"
                            class="data-table product"
                            @selection-change="handleSelectAll($event)"
                        >
                            <el-table-column
                                type="selection"
                                align="center"
                                width="48"
                            >
                                <template slot-scope="scope">
                                    <el-form-item style="margin-bottom: 20px">
                                        <el-checkbox
                                            v-model="scope.row.check_status"
                                            :true-label="1"
                                            :false-label="0"
                                        />
                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column
                                label="商品规格"
                                show-overflow-tooltip
                                :formatter="emptyFormatter"
                                width="200"
                            >
                                <template slot-scope="scope">
                                    <el-form-item style="margin-bottom: 20px">
                                        {{ scope.row.spec_list | filterSpec }}
                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column
                                prop="product_price"
                                label="原售价"
                                show-overflow-tooltip
                                align="center"
                                :formatter="emptyFormatter"
                            >
                                <template slot-scope="scope">
                                    <el-form-item
                                        style="margin-bottom: 20px"
                                    >
                                        {{ scope.row.product_price }}
                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column
                                label="活动价格"
                                width="240"
                            >
                                <template slot-scope="scope">
                                    <el-form-item
                                        :prop="`price_list[${scope.$index}]`"
                                        :rules="rules.price"
                                        style="margin-bottom: 20px"
                                    >
                                        <el-input
                                            v-model="scope.row.price"
                                            style="width: 148px;"
                                            size="medium"
                                            :disabled="scope.row.check_status === 0"
                                            @click.native="clickDisableInput(scope.row)"
                                        />
                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column
                                label="活动库存"
                                width="240"
                            >
                                <template slot-scope="scope">
                                    <div
                                        class="input-wrapper"
                                        style="display: flex; align-items: center;margin-bottom: 20px"
                                    >
                                        <el-select
                                            v-model="scope.row.stock_type"
                                            :style="{width: scope.row.stock_type === 1 ? '138px' : '108px'}"
                                            size="medium"
                                            :disabled="scope.row.check_status === 0"
                                            @change="handleStockTypeChange($event, scope.$index)"
                                            @click.native="clickDisableInput(scope.row)"
                                        >
                                            <el-option
                                                label="同步商家库存"
                                                :value="1"
                                            />
                                            <el-option
                                                label="自定义"
                                                :value="2"
                                            />
                                        </el-select>
                                        <el-form-item
                                            v-if="scope.row.stock_type === 2"
                                            :prop="`price_list[${scope.$index}]`"
                                            :rules="rules.stock"
                                        >
                                            <el-input
                                                v-model.number="scope.row.stock"
                                                style="width: 88px;margin-left: 10px"
                                                size="medium"
                                                :disabled="scope.row.check_status === 0"
                                                @click.native="clickDisableInput(scope.row)"
                                            />
                                        </el-form-item>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                prop="product_stock"
                                label="实际库存"
                                show-overflow-tooltip
                                align="center"
                            >
                                <template slot-scope="scope">
                                    <el-form-item
                                        style="margin-bottom: 20px"
                                    >
                                        {{ scope.row.product_stock }}
                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column
                                label="是否平台补贴"
                                align="center"
                                width="200px"
                            >
                                <template slot-scope="scope">
                                    <el-form-item
                                        style="margin-bottom: 20px"
                                    >
                                        <el-select
                                            v-model="scope.row.shop_subsidy_enable"
                                            size="medium"
                                            style="width: 140px"
                                            :disabled="scope.row.check_status === 0"
                                            @click.native="clickDisableInput(scope.row)"
                                            @change="handleSubsidyChange($event, scope.$index)"
                                        >
                                            <el-option
                                                label="平台补贴"
                                                :value="1"
                                            />
                                            <el-option
                                                label="商家全部补贴"
                                                :value="0"
                                            />
                                            <el-option
                                                label="商家部分补贴"
                                                :value="2"
                                            />
                                        </el-select>
                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column
                                label="商家补贴金额（元）"
                                align="center"
                                width="200px"
                            >
                                <template slot-scope="scope">
                                    <el-form-item
                                        :prop="`price_list[${scope.$index}]`"
                                        :rules="rules.shop_subsidy_money_by_shop"
                                        style="margin-bottom: 22px"
                                    >
                                        <el-input
                                            v-model="scope.row.shop_subsidy_money_by_shop"
                                            placeholder="商家补贴金额"
                                            size="medium"
                                            clearable
                                            style="width: 120px"
                                            @click.native="clickDisableInput(scope.row)"
                                            :disabled="scope.row.shop_subsidy_enable !== 2 || scope.row.check_status === 0"
                                        />
                                    </el-form-item>
                                </template>
                            </el-table-column>
                        </el-table>
                    </el-form-item>
                </template>
                <div v-if="ruleForm.aim_type === 'platform_coupon'">
                    <el-form-item label="平台优惠券编号">
                        {{ ruleForm.coupon_no }}
                    </el-form-item>
                    <el-form-item
                        label="平台优惠券标题"
                        v-if="coupon.title"
                    >
                        {{ coupon.title }}
                    </el-form-item>
                    <el-form-item
                        label="平台优惠券数量"
                        v-if="coupon.total_num_max"
                    >
                        {{ coupon.total_num_max }}
                    </el-form-item>
                </div>
                <div v-if="ruleForm.aim_type === 'merchant_coupon'">
                    <el-form-item label="商家优惠券编号">
                        {{ ruleForm.shop_coupon_no }}
                    </el-form-item>
                    <el-form-item
                        label="商家优惠券标题"
                        v-if="shop_coupon.title"
                    >
                        {{ shop_coupon.title }}
                    </el-form-item>
                    <el-form-item
                        label="商家优惠券数量"
                        v-if="shop_coupon.total_num_max"
                    >
                        {{ shop_coupon.total_num_max }}
                    </el-form-item>
                </div>
                <div v-if="ruleForm.aim_type === 'red_packet'">
                    <el-form-item label="平台红包编号">
                        {{ ruleForm.packet_no }}
                    </el-form-item>
                    <el-form-item
                        label="平台红包标题"
                        v-if="packet.title"
                    >
                        {{ packet.title }}
                    </el-form-item>
                    <el-form-item
                        label="平台红包数量"
                        v-if="packet.total_num_max"
                    >
                        {{ packet.total_num_max }}
                    </el-form-item>
                </div>
                <el-form-item
                    label="砍价标题"
                    prop="title"
                    key="title"
                    v-if="ruleForm.aim_type === 'platform_coupon' || ruleForm.aim_type === 'red_packet'"
                >
                    <el-input
                        v-model="ruleForm.title"
                        placeholder="砍价标题"
                        size="medium"
                        clearable
                        style="width: 380px"
                    />
                    <span class="tips">砍价活动页显示的标题</span>
                </el-form-item>
                <el-form-item
                    label="活动数量"
                    prop="stock"
                    key="stock"
                    v-if="ruleForm.aim_type !== 'goods'"
                >
                    <el-input
                        v-model="ruleForm.stock"
                        placeholder="活动数量"
                        size="medium"
                        clearable
                        style="width: 380px"
                    />
                </el-form-item>
                <el-form-item
                    label="排序号"
                    prop="sort"
                >
                    <el-input
                        oninput="value = value.replace(/[^\d]/g,'')"
                        v-model.number="ruleForm.sort"
                        size="medium"
                        clearable
                        style="width: 380px"
                    />
                </el-form-item>
                <el-form-item
                    label="砍价刀数"
                    prop="require_bargain_count"
                >
                    <el-input
                        v-model="ruleForm.require_bargain_count"
                        size="medium"
                        clearable
                        style="width: 380px"
                    />
                </el-form-item>
            </el-form>
            <!--/表单-->

            <div class="btn-group">
                <el-button
                    size="medium"
                    style="width: 120px"
                    @click="handleCancel()"
                >
                    取消
                </el-button>
                <el-button
                    size="medium"
                    type="primary"
                    style="width: 120px"
                    @click="handleSubmit()"
                >
                    完成
                </el-button>
            </div>
        </div>

        <!-- 选择优惠券 -->
        <shop-coupon-select
            ref="couponSelect"
            @emit="emitCouponData"
        />
        <!-- 选择商家优惠券 -->
        <shop-coupon-select
            ref="shopCouponSelect"
            @emit="emitShopCouponData"
        />
        <!-- 选择红包 -->
        <red-packet-select
            ref="redPacketSelect"
            @emit="emitRedPacketData"
        />
        <!--商品选择弹窗-->
        <goods-select
            ref="goodsSelect"
            @change="handleSelectGoods"
        />
        <!-- 图片预览 -->
        <img-preview ref="preview"/>
    </div>
</template>

<script>
/**
 * 页面接收参数
 * @param no - 商品编号
 */

import {back} from '@/mixin/back';
import GoodsSelect from '@/components/goods/goods-select';
import imgPreview from '@/components/common/img-preview';
import couponSelect from '@/components/coupon/coupon-select.vue';
import shopCouponSelect from '@/components/coupon/shop-coupon-select.vue';
import redPacketSelect from '@/components/coupon/packet-select.vue';
import {deepClone} from "@/assets/js/utils";
const numberReg = /(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0)$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/;
const typeMap = new Map([
    ['goods', 'goods_no'],
    ['platform_coupon', 'coupon_no'],
    ['merchant_coupon', 'shop_coupon_no'],
    ['red_packet', 'packet_no'],
]);

export default {
    name: "BargainGoodsEdit",
    data() {
        const validatePrice = (rule, value, callback) => {
            if(value.check_status && value.price === '') {
                callback(new Error('请填写活动价'));
            } else if(value.price && !numberReg.test(value.price)) {
                callback(new Error('活动价必须未数字'));
            } else {
                callback();
            }
        };
        const validateStock = (rule, value, callback) => {
            // 选择商品
            if(typeof value === 'object') {
                if(value.check_status && value.stock === '') {
                    callback(new Error('请填写活动库存'));
                } else if(value.stock && !numberReg.test(value.stock)) {
                    callback(new Error('活动库存为数字'));
                } else if(value.stock && value.stock > value.product_stock) {
                    callback(new Error('不能大于商家库存'));
                } else {
                    callback();
                }
            }
            // 非商品
            if(typeof value === 'string') {
                if(value === '') {
                    callback(new Error('请填写活动库存'));
                } else if(!numberReg.test(value)) {
                    callback(new Error('活动库存为数字'));
                } else if(value && this.ruleForm.aim_type === 'platform_coupon' && Number(value) > this.coupon.total_num_max) {
                    callback(new Error('不能大于优惠券数量'));
                } else if(value && this.ruleForm.aim_type === 'merchant_coupon' && Number(value) > this.shop_coupon.total_num_max) {
                    callback(new Error('不能大于商家优惠券数量'));
                } else if(value && this.ruleForm.aim_type === 'red_packet' && Number(value) > this.packet.total_num_max) {
                    callback(new Error('不能大于红包数量'));
                } else {
                    callback();
                }
            }
        };

        return {
            // 页面类型 add添加 edit编辑
            type: 'add',
            ruleForm: {
                activity_no: '',
                // 编辑时编号
                bargain_no: '',
                // goods 商品 platform_coupon 优惠券 merchant_coupon 商家优惠券 red_packet 平台红包
                aim_type: 'goods',
                aim_no: '',
                // 商品编号
                goods_no: '',
                // 优惠券编号
                coupon_no: '',
                // 商家优惠券编号
                shop_coupon_no: '',
                // 红包编号
                packet_no: '',
                // 活动标题
                title: '',
                // 砍价刀数
                require_bargain_count: '',
                // 库存数量
                stock: '',
                // 排序号
                sort: 99,
                // 规格价格列表
                price_list: [],
            },
            // 商品信息
            goods: {
                // 商品原标题
                goods_title: '',
                // 商品原价
                goods_price: '',
                // 封面图
                goods_cover: '',
            },
            // 优惠券信息
            coupon: {
                title: '',
                total_num_max: '',
            },
            // 店铺优惠券信息
            shop_coupon: {
                title: '',
                total_num_max: '',
            },
            // 红包信息
            packet: {
                title: '',
                total_num_max: '',
            },
            // 校验规则
            rules: {
                goods_no: [
                    {required: true, message: '请选择商品', trigger: 'change'}
                ],
                coupon_no: [
                    {required: true, message: '请选择优惠券', trigger: 'change'}
                ],
                shop_coupon_no: [
                    {required: true, message: '请选择商家优惠券', trigger: 'change'}
                ],
                packet_no: [
                    {required: true, message: '请选择平台红包', trigger: 'change'}
                ],
                title: [
                    {required: true, message: '砍价不能为空', trigger: 'blur'}
                ],
                sort: [
                    {required: true, message: '排序号不能为空', trigger: 'blur'}
                ],
                require_bargain_count: [
                    {required: true, message: '砍价刀数不能为空', trigger: 'blur'},
                    {pattern: /^\d{1,}$/, message: '砍价刀数必须为正整数', trigger: 'blur'},
                ],
                stock: [
                    {validator: validateStock, trigger: 'blur'},
                ],
                price: [
                    {validator: validatePrice, trigger: 'blur'}
                ],
                hire_subsidy_money_by_hire: [
                    {required: true, message: '补贴金额不能为空', trigger: 'blur'}
                ]
            },
            requestUrl: '',
        };
    },
    mixins: [back],
    components: {
        GoodsSelect,
        couponSelect,
        shopCouponSelect,
        redPacketSelect,
        imgPreview
    },
    filters: {
        filterSpec (val) {
            let str = '';

            val.forEach(element => {
                str += element.spec_name + ':' + element.spec_value + '; ';
            });
            return str;
        }
    },
    mounted() {
        let query = this.$route.query;

        this.$store.commit('SET_HEADER', [{title: "APP后台"}, {title: '商城'},{title: '砍价活动'}, {
            title: '活动管理',
            path: '/student/bargain-activity-list'
        },{
            title: '商品管理',
            path: `/student/bargain-goods-list?activity_no=${query.activity_no}`
        }, {title: query.type === 'add' ? '添加内容' : '编辑内容'}]);
        this.type = query.type;
        this.ruleForm.activity_no = query.activity_no;
        if (query.bargain_no) {
            this.ruleForm.bargain_no = query.bargain_no;
            this.getDetail();
        }
    },
    methods: {
        /**
         * 查看图片
         * @param   {String}    images      //单图预览
         * @param   {Array}     images      //多图预览
         */
        fnShowPreview(images) {
            if (images && Object.prototype.toString.call(images) == '[object String]') {
                this.$refs.preview.show([
                    images
                ]);
            } else if (images && Object.prototype.toString.call(images) == '[object Array]') {
                this.$refs.preview.show(images);
            } else {
                this.$message({
                    type: 'warning',
                    message: '图片类型错误'
                });
            }
        },

        /**
         * 提交
         */
        handleSubmit() {
            this.$refs.ruleForm.validate((valid) => {
                if (valid) {
                    let params = deepClone(this.ruleForm);

                    params.product_json = JSON.stringify(params.price_list);
                    delete params.price_list;
                    params.aim_no = params[typeMap.get(params.aim_type)];
                    if(params.aim_type === 'merchant_coupon' && this.type === 'add') params.title = this.shop_coupon.title;
                    console.log(params);
                    this.$post('/student/shop_tool_bargain%5Cbargain%5Csave', params, resp => {
                        if (resp.code === 1) {
                            this.$notify({
                                title: '提示',
                                message: '保存成功',
                                type: 'success',
                                duration: 2000
                            });
                            this.handleRoute('bargainGoodsList', {activity_no: this.ruleForm.activity_no});
                        } else {
                            this.$notify({
                                title: '提示',
                                message: resp.msg,
                                duration: 2000,
                                type: 'warning'
                            });
                        }
                    });

                }
            });
        },

        /**
         * 返回列表
         */
        handleCancel() {
            this.$confirm('返回后将不会保存您所修改的内容,是否返回?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.handleRoute('bargainGoodsList',{activity_no: this.ruleForm.activity_no});
            });
        },

        /**
         * 编辑时获取详情
         */
        getDetail() {
            let params = {
                bargain_no: this.ruleForm.bargain_no
            };

            this.$post('/student/shop_tool_bargain%5Cbargain%5Cget', params, resp => {
                if (resp.code === 1) {
                    this.ruleForm[typeMap.get(resp.data.aim_type)] = resp.data.aim_no;
                    this.ruleForm.aim_type = resp.data.aim_type;
                    this.ruleForm.require_bargain_count = resp.data.require_bargain_count;
                    this.ruleForm.title = resp.data.title;
                    this.ruleForm.stock = resp.data.stock;
                    this.ruleForm.sort = resp.data.sort;
                    resp.data.product_list.forEach(item => {
                        if(item.stock === -1 || !item.stock) {
                            item.stock_type = 1;
                        } else {
                            item.stock_type = 2;
                        }
                    });
                    this.ruleForm.price_list = resp.data.product_list;
                } else {
                    this.$notify({
                        title: '提示',
                        message: resp.msg,
                        duration: 2000,
                        type: 'warning'
                    });
                }
            });
        },

        /**
         * 获取选择的商品
         * @param val
         */
        handleSelectGoods(val) {
            this.ruleForm.goods_no = val.goods_no;
            this.ruleForm.title = val.goods_title;
            this.goods.goods_title = val.goods_title;
            this.goods.goods_price = val.goods_price;
            this.goods.goods_cover = val.goods_cover;
            val.product_list.forEach(item => {
                this.$set(item, 'check_status', 0);
                this.$set(item, 'price', '');
                this.$set(item, 'stock_type', 1);
                this.$set(item, 'stock', -1);
                this.$set(item, 'shop_subsidy_enable', 1);
                this.$set(item, 'shop_subsidy_money_by_shop', 0);
            });
            this.ruleForm.price_list = val.product_list;
        },


        /**
         * 获取优惠券
         * @param val
         */
        emitCouponData(val) {
            let data = val.list[0];

            this.$refs.couponSelect.close();
            this.ruleForm.coupon_no = data.coupon_no;
            this.ruleForm.title = data.title;
            this.coupon.title = data.title;
            this.coupon.total_num_max = data.total_num_max;
        },

        /**
         * 获取商家优惠券
         * @param val
         */
        emitShopCouponData(val) {
            let data = val.list[0];

            this.$refs.shopCouponSelect.close();
            this.ruleForm.shop_coupon_no = data.coupon_no;
            this.ruleForm.title = data.title;
            this.shop_coupon.title = data.title;
            this.shop_coupon.total_num_max = data.total_num_max;
        },

        /**
         * 获取红包
         * @param val
         */
        emitRedPacketData(val) {
            let data = val.list[0];

            this.$refs.redPacketSelect.close();
            this.ruleForm.packet_no = data.packet_no;
            this.ruleForm.title = data.title;
            this.packet.title = data.title;
            this.packet.total_num_max = data.total_num_max;
        },

        /**
         * 路由跳转
         * @param routeName
         * @param query
         */
        handleRoute(routeName, query) {
            this.$router.push({
                name: routeName,
                query
            });
        },

        /**
         * @description 过滤函数
         */
        emptyFormatter(row, column, val) {
            if (!val) return '--';
            return val;
        },

        /**
         * 全选
         * @param selection
         */
        handleSelectAll(selection) {
            this.ruleForm.price_list.forEach(item => {
                this.$set(item, 'check_status', selection.length ? 1 : 0);
            });
        },

        /**
         * 选择库存类型
         * @param val
         * @param index
         */
        handleStockTypeChange(val, index) {
            if(val === 1) {
                this.ruleForm.price_list[index].stock = -1;
            } else {
                this.ruleForm.price_list[index].stock = 0;
            }
        },

        /**
         * 是否平台补贴切换
         * @param val
         * @param index
         */
        handleSubsidyChange(val, index) {
            if(val !== 2) {
                this.ruleForm.price_list[index].shop_subsidy_money_by_shop = 0;
            }
        },

        /**
         * 点击禁用的input
         * @param row
         */
        clickDisableInput(row) {
            if(!row.check_status) {
                this.$message.warning('请勾选该规格');
            }
        },
    }
};
</script>

<style scoped lang="less">
.wrapper {
    width: 100%;

    .content-wrapper {
        display: flex;
        height: calc(100% - 24px);
        flex-direction: column;
        position: relative;
        margin: 12px;
        background: #fff;
        box-sizing: border-box;
        overflow-y: auto;
        &::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        /*header*/

        .header {
            height: 68px;
            padding: 24px;
            box-sizing: border-box;
            box-shadow: 0px -1px 0px 0px #F0F2F5;
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid #F0F2F5;

            .header-title {
                color: #333333;
                font-size: 20px;
                height: 20px;
                font-weight: 500;
                position: relative;
                margin: 24px 0 24px 12px;

                &::before {
                    content: '';
                    position: absolute;
                    left: -8px;
                    top: -1px;
                    width: 3px;
                    height: 20px;
                    background: #1890FF;
                }
            }
        }

        /*表单*/

        .form-wrap {
            padding: 30px;

            .zd-spec {
                display: flex;
                font-size: 14px;
                padding-right: 12px;

                .zd-spec-luck-text {
                    margin-right: 10px;
                }
            }

            /deep/ .el-checkbox-group {
                display: flex;
                flex-direction: column;

                .zd-spec {
                    display: flex;
                    overflow: hidden;
                    white-space: nowrap;
                    text-overflow: ellipsis;

                    .zd-spec-text {
                        font-size: 14px;
                        margin-right: 10px;
                    }
                }

                .el-checkbox {
                    width: min-content;
                }
            }

            .tips {
                margin-left: 24px;
                font-size: 14px;
                color: #999;
            }

            .el-radio-group-wrap {
                display: flex;
                flex-direction: column;
                margin-top: 12px;

                .el-radio {
                    display: flex;
                }
            }
        }

        .btn-group {
            margin-left: 120px;
            padding-bottom: 36px;

            .el-button {
                margin: 0 24px;
            }
        }
    }

    .price-view {
        width: 100%;
        display: flex;
        flex-direction: column;
        margin-bottom: 26px;
        .base {
            display: flex;
            margin-bottom: 12px;
        }
        .hire-money {
            display: flex;
        }
    }

    /*el-tabs*/

    /deep/ .el-tabs {

        .el-tabs__nav-wrap {
            height: 54px;
            padding-left: 24px;

            .el-tabs__nav-scroll {
                .el-tabs__nav {
                    height: 54px;
                    line-height: 54px;
                }
            }
        }
    }
    // 表格
    .data-table {
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        // 操作按钮
        .option-btn-group {
            .el-button {
                margin-left: 0;
                margin-right: 10px;
            }
        }
    }
    /deep/ .el-table {
        th {
            background: #f2f2f2!important;
        }
        td {
            border-bottom: 0!important;
            background: #FBFBFB!important;
        }
    }
    /deep/ .el-table.product {
        background: #FBFBFB!important;
        .el-table__body-wrapper {
            padding-top: 12px;
        }
    }
}
</style>
